package FlowGraph.Nodes;

import antlr.collections.AST;

import util.Line;
import FlowGraph.FlowGraphNode;
import FlowGraph.FlowGraph;

//////////////////////////////////////////////////////////////////////////
//// FinallyBeginNode
/**

@author Ivan Jeukens
@version v 0.1 21/02/2002
*/
public class FinallyBeginNode extends FlowGraphNode {

    public FinallyBeginNode(AST node) {
        super(node, FINALLY_BEGIN, 1, 1);
    }

    ///////////////////////////////////////////////////////////////////
    ////                        public methods                     ////

    public String toString() {
        return new String("finally()");
    }

    public void setFinallyEnd(FinallyEndNode end) {
        _end = end;
    }
    
    public FinallyEndNode getFinallyEnd() {
        return _end;
    }
    
     public void setBegLine(Line l) {
        _begLine = l;
    }
    
    public Line getBegLine() {
        return _begLine;
    }

    public void setEndLine(Line l) {
        _endLine = l;
    }

    public Line getEndLine() {
        return _endLine;
    }

    public void addEndToSinkEdge(FlowGraph fg) {
        FlowGraphNode sink = fg.getSink();
        if(!_end.hasOutput(sink)) {
            fg.connect(_end, sink);
        }
    }

    ///////////////////////////////////////////////////////////////////
    ////                      private variables                    ////

    private FinallyEndNode _end;
    private Line _endLine;
    private Line _begLine;
}
